// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    noticeChecked: false,
    
    popRuleShow: false,
    ruleBtnDis: true,
    ruleRoundTime: "5'",

    popLotteryShow: false,
    popLotteryResultShow: false,

    lotteryText: '恭喜获得四等奖现金红包',
    lotteryNum: "5.8",
    rollingNumhundredList: [0,0,6,0],
    rollingNumtenList: [5,8,8,5],
    rollingNumunitList: [8,8,8,8],
    hundredClass: 'rolling',
    tenClass: 'rolling',
    unitClass: 'rolling',

    popLotteryBestShow: false
  },
  lotteryShowTap: function(e) {
    //   let timer, that = this, num = 0;
    //   timer = setInterval(function() {
    //       //console.log(num)
    //     switch(num) {
    //         case 0:
    //           that.setData({
    //               hundredClass: 'zero',
    //               tenClass: 'five',
    //               unitClass: 'eight',
    //           })
    //           num = 1;
    //           setTimeout(function () {
    //             that.setData({
    //                 hundredClass: 'rolling',
    //                 tenClass: 'rollingFive',
    //                 unitClass: 'rollingEight',
    //             })
    //           },1000)
    //           break;
    //         case 1:
    //           that.setData({
    //               hundredClass: 'zero',
    //               tenClass: 'eight',
    //               unitClass: 'eight',
    //           })
    //           num = 2;
    //           setTimeout(function () {
    //             that.setData({
    //                 hundredClass: 'rolling',
    //                 tenClass: 'rollingEight',
    //                 unitClass: 'rollingEight',
    //             })
    //           },1000)
    //           break
    //         case 2:
    //           that.setData({
    //               hundredClass: 'six',
    //               tenClass: 'eight',
    //               unitClass: 'eight',
    //           })
    //           num = 0;
    //           setTimeout(function () {
    //             that.setData({
    //                 hundredClass: 'rollingSix',
    //                 tenClass: 'rollingEight',
    //                 unitClass: 'rollingEight',
    //             })
    //           },1000)
    //           break
    //     }
    //   },4000);
    this.setData({
        popLotteryResultShow: true
    })
  },
  lotteryTap: function(e) {
    this.setData({
        popLotteryShow: true
    })
  },
  popRuleClose: function(e) {
    this.setData({
        popRuleShow: false,
        noticeChecked: true
    })
  },
  ruleShowTap: function(e) {
    this.setData({
        popRuleShow: true
    })
    if (!this.data.ruleBtnDis) return;
    let num = 5, that = this, timeRounder;
    timeRounder = setInterval(function(){
        num --;
        if (num == 0) {
            clearInterval(timeRounder);
            that.setData({
                ruleRoundTime: "",
                ruleBtnDis: false
            })
        } else {
            that.setData({
                ruleRoundTime: num+"'",
            })
        }
    },1000)
  },
  onLoad() {
    
  },
})
